﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Spinning.Spinning.Unitity;
using Microsoft.Xna.Framework;
using Spinning.Spinning.EntityModifiers;
using Spinning.Spinning.Level;
using Microsoft.Xna.Framework.Input.Touch;
namespace Spinning.Spinning.Entity.Scenes
{
    class SuccessScene : BaseScene
    {
        String _gameElement;

        public SuccessScene(String gameElement)
        {
            _gameElement = gameElement;
        }

        public override void OnLoad()
        {
            base.OnLoad();
            Sprite backGroundSprite = new Sprite();
            backGroundSprite.textureName = "bg";
            backGroundSprite.ZIndex = Constants.background;
            backGroundSprite.OnLoad();
            this.Attach(backGroundSprite);

            Sprite getWaterSprite = new Sprite();
            getWaterSprite.textureName = "p4/get_" + _gameElement;
            getWaterSprite.ZIndex = Constants.ui;
            getWaterSprite.OnLoad();
            this.Attach(getWaterSprite);

            ButtonSprite homeSprite = new ButtonSprite();
            homeSprite.textureName = "p4/home";
            homeSprite.ZIndex = Constants.ui;
            homeSprite.Position = new Vector2(340, 680);
            homeSprite.OnLoad();
            TouchManager.RegisteTouchArea(homeSprite);
            this.Attach(homeSprite);

            homeSprite.OnTouchEvent += OnHomeTouch;

        }

        void OnHomeTouch(BaseEntity entity, TouchLocation touchLocation)
        {
            Game1.stageManager.GoToScene("start");
        }

        public override BaseScene Clone()
        {
            BaseScene scene = new SuccessScene(_gameElement);
            scene.Size = new Vector2(Constants.Window_Width, Constants.Window_Height);

            scene.OnLoad();
            scene.SortChildren();
            return scene;
        }
    }
}
